package algorithm.recursionAndbacktrack.combination.p401;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author CandyWall
 * @Date 2022/2/22--17:56
 * @Description 401. 二进制手表
 */
public class Solution_v4 {
    private static List<String>[] timesMap;
    {
        timesMap = new List[10];
        for (int i = 0; i < 10; i++) {
            timesMap[i] = new ArrayList();
        }
        // 统计0-11小时里面每个数字转成二进制以后对应的1的个数
        for (int i = 0; i < 12; i++) {
            // 统计0-59分钟里面每个数字转成二进制以后对应的1的个数
            for (int j = 0; j < 60; j++) {
                timesMap[Integer.bitCount(i) + Integer.bitCount(j)].add(i + ":" + (j < 10 ? "0" + j : j));
            }
        }
    }

    public List<String> readBinaryWatch(int turnedOn) {
        return timesMap[turnedOn];
    }

    public static void main(String[] args) {
        System.out.println(new Solution_v4().readBinaryWatch(1));
    }
}
